trigger ThankYouTask2 on Opportunity (after insert, after update) {
    //Trigger.new[0].Product2__r.OppDate__c  = date.today();
    /*OpportunityContactRole[] oppContactRoles = [select OpportunityId, ContactId from OpportunityContactRole where IsPrimary = TRUE AND OpportunityId in :Trigger.newMap.keyset()];
    Map<ID, OpportunityContactRole> OppMap = new Map<ID,OpportunityContactRole>();
    if(oppContactRoles.size()>0){//Check to prevent exception if new Opportunity is created or there is no Contact Role for Opportunity being updated.
        for(OpportunityContactRole oppContRole: oppContactRoles ){
           OppMap.put(oppContRole.OpportunityId, oppContRole); 
        }
        
        List<Task> ThankYous = new List<Task>();
        
        for(Opportunity Opp : trigger.new){
            //Construct a task to be added to the ThankYou list
            Task ty = new Task();
            ty.WhatId = Opp.Id;
            ty.WhoId = (OppMap.get(Opp.Id)).ContactId; //???????? For new opportunity records the Id is Null... can't be used for-Wait a minute, AFTER INSERT, UPDATE!!!!
            ty.OwnerId = Opp.OwnerId;
            ty.Subject = 'Thank You';
            ThankYous.add(ty);
        }
        insert ThankYous;
    }*/
}